var denglu=document.querySelector('header .member>div')
denglu.onclick=function(){
    document.querySelector('section.login div.item').style.visibility='visible'
}
var tuichu=document.querySelector('section.login div.item .form .close .icon-close')
tuichu.onclick=function(){
    document.querySelector('section.login div.item').style.visibility='hidden'
}
var dlkObj=document.querySelector('section.login div.item .menu')
dlkObj.onmousedown=function(event){
    var olde=event||window.event
        
    document.onmousemove=function(event){
        var e=event||window.event
        var left=e.clientX-olde.offsetX
        var top=e.clientY-olde.offsetY
        if(left<0)left=0
        if(top<0)top=0
        var denglukuang=document.querySelector('section.login div.item')
        var maxleft=(window.innerWidth||document.documentElement.clientWidth)-denglukuang.offsetWidth
        var maxtop=(window.innerHeight||document.documentElement.clientHeight)-denglukuang.offsetHeight
        if(left>maxleft)left=maxleft
        if(top>maxtop)top=maxtop
        denglukuang.style.position='absolute'
        denglukuang.style.left=left+'px'
        denglukuang.style.top=top+'px'
    }
    document.onmouseup=function(){
        document.onmousemove=null
    }
}
var yzm=document.querySelector('section.login .captcha')
var num=60
function fun(){
    yzm.onclick=function(){
        fun()





        var xwyzm=document.querySelector('section.captcha')
        xwyzm.style.visibility='visible'
        document.querySelector('section.captcha h2 .iconfont').onclick=function(){
            xwyzm.style.visibility='hidden'
        }
        var huadong=document.querySelector('section.captcha .drag .btn')
        huadong.onmousedown=function(){
        
            document.onmousemove=function(evt){
                var e=event||window.event
                var left = e.clientX - (xwyzm.offsetLeft - xwyzm.offsetWidth/2) - huadong.offsetWidth
                if(left<0)left=0
                if(left>327)left=327
                huadong.style.left=left+'px'
                xwyzm.querySelector('.check img:nth-of-type(2)').style.left = left + 'px'
            }
            document.onmouseup=function(){
                document.onmousemove=null
                var value=parseInt(huadong.style.left)
                if(value>=260&&value<=265){
                    yzm.innerText=num+'秒后重发'
                    yzm.disabled=true
                    t=setInterval(function(){
                    if(num<=1){
                    clearInterval(t)
                    yzm.innerText='重新发送'
                    num=60
                    yzm.disabled=false
                    return
                    }
                    num--
                    yzm.innerText=num+'秒后重发'
                    },1000)
                    xwyzm.style.visibility='hidden'
                }
                huadong.style.left='0px'
                xwyzm.querySelector('.check img:nth-of-type(2)').style.left = '0px'
            }
        }
        return






        
    }
}
fun()
function d(){
    var dl=document.querySelector('.submit')
    var isok=0
    dl.onclick=function(){
        d()
        var dlk=document.querySelector('.mobile').value
        if(dlk==''||dlk.length!=11||!Number(dlk)){
            document.querySelector('section.login .form>p:nth-of-type(3)').innerText='手机格式有误'
        }else{
            isok++
            document.querySelector('section.login .form>p:nth-of-type(3)').innerText=''
        }
        var mmk=document.querySelector('.password').value
        if(mmk==''||mmk.length!=4||!Number(mmk)){
            document.querySelector('section.login .form>p:nth-of-type(4)').innerText='密码只能是四位数'
        }else{
            isok++
            document.querySelector('section.login .form>p:nth-of-type(4)').innerText=''
        }
        if(isok==2){
            alert('成功')
        }
    }
}
d()
    
